import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import storage from '@/utils/storage'

// 登录
export const useLoginStore = defineStore('useLoginStore', () => {
  const loginData = storage.getItem('USER_INFO') || {}

  const menuData = ref([])
  function changeLoginData(data) {
    storage.setItem('USER_INFO', data)
    loginData.value = data
  }
  function changeMenuData(data) {
    menuData.value = data
  }

  return {
    loginData,
    changeLoginData,
    menuData,
    changeMenuData,
  }
})
